package com.seannews.server.Pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Arrays;
import java.util.Date;

@Data//注在类上，提供类的get、set、equals、hashCode、canEqual、toString方法
@TableName("userinfo")//@TableName是mybatis-plus中的注解，主要是实现实体类型和数据库中的表实现映射。
public class User {
    private String Userid;
    private String Userpasswd;
    private int Usertype;
    private String Username;
    @JSONField(format ="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date Createtime;
    private int Readcount;
    private int sport;
    private int game;
    private int fashin;
    private int headline;
    private int mainnews;
    private int military;
    private int health;
    private int stock;
    private String habbit;
    User(){
        this.habbit=gethabbit();
    }
    public String gethabbit(){
        int[] value = {sport,game,fashin,headline,mainnews,military,headline,stock};
        String[] type={"sport","game","fashin","headline","mainnews","military","headline","stock"};
        int max=0;
        for (int i : value) {
            if(max<i) max=i;
        }
        int index=0;
        for(int i =0;i<value.length;i++){
            if(max==value[i]) index=i;
        }
        return type[index];
    }

}